package com.xand.bt.terminal.ui.depth;

import java.util.List;

public class MarketDepthTableController {

	private MarketDepthTableModel model;
	
	public MarketDepthTableController(MarketDepthTableModel model) {
		
		this.model = model;
		
	}
	
	public void addMarketDepthLevel(int index, MarketDepthLevel level) {
		
		List<MarketDepthLevel> levels = model.getLevels(level.getDirection());
		levels.add(index, level);
		
	}
	
	public void removeMarketDepthLevel(int index, int direction) {
		
		List<MarketDepthLevel> levels = model.getLevels(direction);
		levels.remove(index);
		
	}
	
	public void modifyMarketDepthLevel(int index, int direction, String newVolume, String newPrice) {
		
		List<MarketDepthLevel> levels = model.getLevels(direction);
		MarketDepthLevel level = levels.get(index);
		
		level.setVolume(newVolume);
		level.setPrice(newPrice);

	}
	
	public void updateDisplay() {
		this.model.fireTableDataChanged();
	}
	
}
